package hu.bme.mit.inf.expendables.entities;
	
import javax.persistence.*;
import hu.bme.mit.inf.expendables.entities.*;
import java.util.List;
import java.util.ArrayList;


@Entity
@Table(name="T_CUSTOMERSIMILARITY")
@NamedQueries(
	{
	@NamedQuery(name=CustomerSimilarity.GET_CUSTOMERSIMILARITY,query="SELECT cs FROM CustomerSimilarity cs WHERE ((cs.customer1 = :customer1) AND (cs.customer2 = :customer2)) OR ((cs.customer1 = :customer2) AND (cs.customer2 = :customer1))"),
	@NamedQuery(name=CustomerSimilarity.UPDATE_CUSTOMERSIMILARITY,query="UPDATE CustomerSimilarity cs SET cs.score = :score WHERE ((cs.customer1 = :customer1) AND (cs.customer2 = :customer2)) OR ((cs.customer1 = :customer2) AND (cs.customer2 = :customer1))"),
	@NamedQuery(name=CustomerSimilarity.GET_CUSTOMERSIMILARITIES,query="SELECT cs FROM CustomerSimilarity cs WHERE ((cs.customer1 = :customer) OR (cs.customer2 = :customer))")
	})
public class CustomerSimilarity {
	                        	
	public static final String GET_CUSTOMERSIMILARITY = "GetCustomerSimilarity";
	public static final String UPDATE_CUSTOMERSIMILARITY = "UpdateCustomerSimilarity";
	public static final String GET_CUSTOMERSIMILARITIES = "GetCustomerSimilarities";

	//Attributes
	private float score;
	
	@Id
	@GeneratedValue
	@Column(name="CUSTOMERSIMILARITY_ID")
	private long customerSimilarityId;
	

	//Reference to Customer
	@ManyToOne
	@JoinColumn(name = "CUSTOMER1_ID")
	private Customer customer1;
	
	//Reference to Customer
	@ManyToOne
	@JoinColumn(name = "CUSTOMER2_ID")
	private Customer customer2;
	


	//Getters and Setters
	public float getScore(){
		return score;
	}
	
	public void setScore(float score){
		this.score = score;
	}
	
	public long getCustomerSimilarityId(){
		return customerSimilarityId;
	}
	
	public void setCustomerSimilarityId(long customerSimilarityId){
		this.customerSimilarityId = customerSimilarityId;
	}
	

	public Customer getCustomer1(){
		return customer1;
	}
	
	public void setCustomer1(Customer customer1){
		this.customer1 = customer1;
	}
		
	public Customer getCustomer2(){
		return customer2;
	}
	
	public void setCustomer2(Customer customer2){
		this.customer2 = customer2;
	}
		
}